package com.middleware.mvc.model;

import com.sun.istack.internal.Nullable;

import java.util.Map;

public class ModelAndView {

    @Nullable
    private Object view;
    @Nullable
    private Map<String,Object> model;

    public ModelAndView() {
    }
    public ModelAndView(Object view) {
        this.view = view;
    }


    public void setViewName(Object viewName){
        this.view = viewName;
    }

    public void addObject(String key,Object value){
        if(model == null){
            model = new java.util.HashMap<>();
        }
        model.put(key,value);
    }

    public Object getView(){
        return view;
    }

    public Map<String,Object> getModel(){
        return model;
    }

}
